import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "",
      redirect: "/home",
    },
    {
      path: "/login",
      name: "login",
      component: () => import("../views/LoginView.vue"),
    },
    {
      name: "layout",
      component: () => import("../layout/index.vue"),
      children: [
        {
          path: "/index",
          name: "index",
          component: () => import("../views/IndexView.vue"),
        },
        {
          path: "/home",
          name: "home",
          component: () => import("../views/HomeView.vue"),
        },
        {
          path: "/resource",
          name: "resource",
          component: () => import("../views/ResourceView.vue"),
        },
        {
          path: "/parameter",
          name: "parameter",
          component: () => import("../views/ParameterView.vue"),
        },
        {
          path: "/setting",
          name: "setting",
          component: () => import("../views/SettingView.vue"),
        },
        {
          path: "/map/:id",
          name: "map",
          component: () => import("../views/MapView.vue"),
        },
      ],
    },
  ],
});

export default router;
